< previous page page_800 next page >

Page 800
Type.gifListing 21.5. Resizing the controls at runtime.
Private Sub Form_Resize()
    '
    If Me.WindowState <> vbMinimized Then
        With SSTab1
            .Left = 1
            .Top = 1
            .Width = Me.ScaleWidth
            .Height = Me.ScaleHeight - 540
        End With
    End If
    '
    objRec.BBInit Me
    '
End Sub
You also need to add some code (shown in Listing 21.6) to the TxtField_KeyPress event. This code prevents users from editing the Last Log In or Last Log Out fields on the form.
Type.gifListing 21.6. Disabling entry in the TxtField_KeyPress event.
Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer)
    '
    ' trap keystrokes
    '
    Select Case Index
        Case 0 ' userid
            KeyAscii = Asc(UCase(Chr(KeyAscii)))
        Case 1 ' password
        Case 2 ' username
        Case 3 ' last log in
            KeyAscii = 0
        Case 4 ' last log out
            KeyAscii = 0
    End Select
    '
End Sub
Now save the project. Before you can run this project, you need to add some code to the class module, too. First, set its name to usrObject and save the project just to be safe. Next, add some declarations to the top of the module, based on Listing 21.7.
Type.gifListing 21.7. User-related declarations for the usrbject class.
Option Explicit
'
' user login/out vars

 
< previous page page_800 next page >

If you like this book, buy it!